namespace FServer.Core.Interfaces;

public interface ICacheService
{
    Task<T?> GetAsync<T>(string key);
    Task SetAsync<T>(string key, T value, TimeSpan? expiry = null);
    Task DeleteAsync(string key);
    Task<bool> ExistsAsync(string key);
    Task<Dictionary<string, T>> GetManyAsync<T>(IEnumerable<string> keys);
    Task SetManyAsync<T>(Dictionary<string, T> values, TimeSpan? expiry = null);
    Task DeleteManyAsync(IEnumerable<string> keys);
    Task<long> IncrementAsync(string key, long value = 1);
    Task<long> DecrementAsync(string key, long value = 1);
    Task<bool> SetIfNotExistsAsync<T>(string key, T value, TimeSpan? expiry = null);
    Task<bool> ExpireAsync(string key, TimeSpan expiry);
    Task<TimeSpan?> GetExpiryAsync(string key);
    Task<IEnumerable<string>> GetKeysAsync(string pattern);
    Task DeleteByPatternAsync(string pattern);
}
